<template>
	<view class="newOrder">
		<view class="form">
			<view class="form_item1">
				<view class="text"> <text>*</text>货号: </view>
				<view class="input">
					{{ productItem.proId }}
				</view>
			</view>
			<!-- <view class="form_item1">
        <view class="text"> <text>*</text>颜色: </view>
        <view class="input">
          {{ productItem.proColor }}
        </view>
      </view> -->
			<view class="form_item1">
				<view class="text"> <text>*</text>单价: </view>
				<view class="input">
					{{ productItem.proPrice }}
				</view>
			</view>
			<!-- <view class="form_item1">
        <view class="text"> <text>*</text>尺码: </view>
        <view class="input">
          {{ productItem.proSize }}
        </view>
      </view> -->
			<view class="form_item1">
				<view class="text"> 备注: </view>
				<view class="input">
					{{ productItem.remark || "-"}}
				</view>
			</view>
		</view>
		<view class="footer_btn">
			<view class="" @tap="
		    skip(
		      `/pages/product/edit_details?productItem=` +
		        encodeURIComponent(JSON.stringify(productItem))
		    )
		  ">
				修改
			</view>
			<view class="" @tap="del"> 删除产品 </view>
			<!-- <navigator url="/pages/product/edit_details"> -->

			<!-- </navigator> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				productItem: {},
			};
		},
		methods: {
			del() {

				let that = this
				uni.showModal({
					content: "确定要删除吗？",
					success(res) {
						// console.log(res)
						if (res.confirm) {
							that.$api.puoductDelApi({
								id: that.productItem.id,
								proId: that.productItem.proId
							}).then((res) => {
								if (res.code == 200) {
									uni.showToast({
										title: "删除成功",
										icon: "none",
									});
									uni.navigateBack({
										delta: 1
										// url: "/pages/product/index",
									});
								}
							});
						}
					}
				})


















			},
		},
		onLoad(option) {
			// console.log((JSON.parse(decodeURIComponent(option.productDetail))));
			this.productItem = JSON.parse(decodeURIComponent(option.productDetail));
			// console.log(this.productItem);
		},
	};
</script>

<style lang="scss" scoped>
	.newOrder {
		background: #fff;
		height: 100vh;

		.form {
			padding: 38rpx 68rpx 32rpx 68rpx;
			background-color: #fff;

			.form_item1 {
				color: #bdbdbd;
				margin-bottom: 36rpx;
				text-indent: 1em;
				display: flex;

				.text {
					font-size: 0.875rem;

					text {
						color: #fe3430;
					}
				}

				.input {
					display: flex;
					align-items: center;
					color: #000;
				}
			}
		}

		.footer_btn {
			display: flex;
			justify-content: space-around;
			margin-top: 50rpx;

			view {
				background-image: url("/static/images/Registration/button.png");
				background-size: 280rpx 123rpx;
				color: #fff;
				width: 280rpx;
				height: 123rpx;
				line-height: 100rpx;
				text-align: center;
				border-radius: 49rpx;
			}
		}
	}
</style>
